<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./jQuery.min3.6.0.js"></script>
</head>

<body>
    <form id="form_reg">
        用户名：<input type="text" name="username">
        密码：<input type="text" name="password">
        <input type="submit" value="注册">
    </form>
    <script>
        // 监听登录事件
        $('#form_reg').on('submit', function (e) {
            e.preventDefault();
            var data = $(this).serialize();
            $.ajax({
                type: "POST",
                url: "http://127.0.0.1:5000/api/register",
                data: data,
                success: function (res) {
                    console.log(res);
                }
            });
        });
    </script>
</body>

</html>